Visual Basic (Declaration) | |
---|---|
Public Class InstanceFactory(Of T) Implements IFactory(Of T) |
C# | |
---|---|
public class InstanceFactory<T> : IFactory<T> |
- T
Library/Library.Test/TestFactories.cs
C# | Copy Code |
---|---|
TestObject obj = new TestObject(); IFactory<TestObject> factory = new InstanceFactory<TestObject>(obj); Assert.IsTrue(ReferenceEquals(obj, factory.Create())); Assert.IsTrue(ReferenceEquals(factory.Create(), factory.Create())); |
VB.NET | Copy Code |
---|---|
Dim obj As New TestObject() Dim factory As IFactory(Of TestObject) = New InstanceFactory(Of TestObject)(obj) Assert.IsTrue(ReferenceEquals(obj, factory.Create())) Assert.IsTrue(ReferenceEquals(factory.Create(), factory.Create())) |
System.Object
CSharpTest.Net.Interfaces.InstanceFactory<T>
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7